	var oBody = document.getElementsByTagName('body')[0];
	var oDiv = document.getElementById('playimages');
	var oBtnPrev = document.getElementsByClassName('prev')[0];
	var oBtnNext = document.getElementsByClassName('next')[0];
	var oMarkLeft = document.getElementsByClassName('mark_left')[0];
	var oMarkRight = document.getElementsByClassName('mark_right')[0];
	var oTab = document.getElementsByClassName('tab')[0];
	var aSpan = oDiv.getElementsByTagName('span');
	var aBanner = document.getElementsByClassName('banner');
	var oOn = document.getElementsByClassName('on')[0];
	for(var i = 0; i < aBanner.length; i++) {
		var span= document.createElement('span');
		oTab.appendChild(span);
	}
	aBanner[0].style.opacity = "1";
	aSpan[0].className = "on";
	var num = 0;
	
	
	
	for(var i = 0; i < aBanner.length; i++) {
		aSpan[i].index = i;
		aSpan[i].onclick = function() { //点击小圆点图片相对应的进行切换
			for(var j = 0; j < aBanner.length; j++) {
				num = this.index;
				aSpan[j].className = "";
				aBanner[j].style.opacity = "0";
			}
			aSpan[num].className = "on";
			aBanner[num].style.opacity = "1";
		}
		oBtnNext.onclick = function() { //按下图片切换到后一张
			for(var j = 0; j < aBanner.length; j++) {
				if(aSpan[j].className == "on") {
					aSpan[j].className = "";
					aBanner[j].style.opacity = "0";
					j++;
					num++;
					if(j > (aBanner.length-1)) {
						j = 0;
					}
					aSpan[j].className = "on";
					aBanner[j].style.opacity = "1";
				}
			}
		}

		oBtnPrev.onclick = function() { //按下图片切换到前一张
			for(var j = 0; j < aSpan.length; j++) {
				if(aSpan[j].className == "on") {
					aSpan[j].className = "";
					aBanner[j].style.opacity = "0";
					j--;
					num--;
					if(j < 0) {
						j = (aBanner.length-1);
					}
					aSpan[j].className = "on";
					aBanner[j].style.opacity = "1";
				}
			}
		}
	}

	function Time() { /*设置定时器运行的函数*/
		num++;
		if(num < aBanner.length) {
			for(var j = 0; j < aSpan.length; j++) {
				aSpan[j].className = "";
				aBanner[j].style.opacity = "0";
			}
			aSpan[num].className = "on";
			aBanner[num].style.opacity = "1";
		} else {
			num = -1;
		}
	}
	clearInterval(timer);
	var timer = setInterval("Time()", 3000); /*调用定时器*/

	oDiv.onmouseover = function() { /*鼠标引入，清除定时器，轮播图停止*/
		clearInterval(timer);
	};
	oDiv.onmouseout = function() { /*鼠标移出，重新调用定时器，轮播图开始*/
		clearInterval(timer);
		timer = setInterval("Time()", 3000);
	};
	
	//左右按钮
	oBtnPrev.onmouseover=oMarkLeft.onmouseover=function ()
	{
		startMove(oBtnPrev, 'opacity', 100);
	};
	oBtnPrev.onmouseout=oMarkLeft.onmouseout=function ()
	{
		startMove(oBtnPrev, 'opacity', 0);
	};
	oBtnNext.onmouseover=oMarkRight.onmouseover=function ()
	{
		startMove(oBtnNext, 'opacity', 100);
	};
	oBtnNext.onmouseout=oMarkRight.onmouseout=function ()
	{
		startMove(oBtnNext, 'opacity', 0);
	};

//$(function(){
//	
//	var tab_paddingLeft = ($(document.body).width()-$(".tab").width())/2;
//	$(".tab").css("padding-left",tab_paddingLeft);
//	
//})
